<?php
/**
* @version 			SEBLOD 3.x Core ~ $Id: index.php sebastienheraud $
* @package			SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url				http://www.seblod.com
* @editor			Octopoos - www.octopoos.com
* @copyright		Copyright (C) 2013 SEBLOD. All Rights Reserved.
* @license 			GNU General Public License version 2 or later; see _LICENSE.php
**/

defined( '_JEXEC' ) or die;

// -- Initialize
require_once dirname(__FILE__).'/config.php';
$cck	=	CCK_Rendering::getInstance( $this->template );
if ( $cck->initialize() === false ) { return; }

$doc	=	JFactory::getDocument();
$doc->addStyleSheet( JURI::root( true ).'/templates/'.$cck->template. '/css/'.'style.css' );

$items		=	$cck->getItems();
$positions	=	$cck->getPositions();
unset( $positions['hidden'] );
// -- Render
?>
<div id="<?php echo $cck->id; ?>" class="<?php echo $cck->id_class; ?>cck-list">
	<?php foreach ( $items as $item ): ?>
		<div class="item">
        <?php foreach ( $positions as $name=>$position ):
        	echo "<!-- position:$name -->";
        	$fieldnames	=	$cck->getFields( $name, '', false );?>
            <?php foreach($fieldnames as $fieldname):?>
	        	<div class="field field-<?php echo $fieldname;?>">
	            	<label><?php echo $item->getLabel($fieldname);?>:</label>
	            	<?php echo $item->renderField( $fieldname );?>
	        	</div>
            <?php endforeach;?>
        <?php endforeach;?>
        </div>
	<?php endforeach;?>
</div>
<?php
$cck->finalize();
?>